# -*- coding: utf-8 -*-
import wikipedia
import redis


def get_wiki_page(search_word):
    wikipedia.set_lang("zh")
    print "wiki_api.py中收到的词为：", search_word
    r = redis.Redis(host='127.0.0.1', port=6379, db=0)
    result_content = r.get(search_word)
    if result_content is None:
        result = wikipedia.page(search_word)
        result_content = result.content.encode('utf-8')
        r.set(search_word, result_content)
    print "查询结束的结果为：", result_content
    return result_content
